﻿var CsdnScriptPlugin999 = {
    /// <summary>
    /// 接口版本
    /// </summary>
    interfaceVersion: "1.0",

    /// <summary>
    /// 插件标题，显示给用户看
    /// </summary>
    caption: "个人签名插件",

    /// <summary>
    /// 设计者在CSDN的ID 
    /// </summary>
    designer: "intcry",

    /// <summary>
    /// 按钮对象，可选项
    /// </summary>
    buttons: {},

    /// <summary>
    /// 分隔条对象，可选项
    /// </summary>
    separators: {},

    /// <summary>
    /// 装载，必填项
    /// </summary>
    load: function() {
        this.separators["vertical"] = CsdnScriptWorkshop.addSeparator();
        this.buttons["vertical"] = CsdnScriptWorkshop.addButton(
            "个人签名插件",
            "http://tim-tang.googlecode.com/files/d.gif",            
    },


    /// <summary>
    /// 卸载，必填项
    /// </summary>
    free: function() {
        for (var button in this.buttons)
            CsdnScriptWorkshop.deleteButton(this.buttons[button]);
        for (var separator in this.separators)
            CsdnScriptWorkshop.deleteSeparator(this.separators[separator]);
    }
}
function getUserInfor() {
    if (window.ActiveXObject) {
        var txt = window.parent.document.getElementById("bbscsdn_wrap").innerHTML;
        var reg = /<LI title=总技术分：\d+；总技术排名：\d+><DFN><A onclick=LogClickCount\(this,\d+\)[\s\S]*<\/LABEL> /g;
        var str = txt.match(reg);

        var reg1 = /总技术分：\d+/g;
        var reg2 = /总技术排名：\d+/g;
        var reg3 = /http\:\/\/hi.csdn.net\/\w+/g;
        var reg4 = /<LABEL[\s\S]*LABEL>/g;

        var zjsf = str[0].match(reg1)[0].replace("总技术分：", "");
        var zjspm = str[0].match(reg2)[0].replace("总技术排名：", "");
        var mingzi = str[0].match(reg3)[0].replace("http://hi.csdn.net/", "");

        var txt2 = str[0].match(reg4)[0];
        var reg5 = /\'[\s\S]*\'/g;
        var txt3 = txt2.match(reg5)[0];

        var reg6 = /截至[\s\S]*\\n用户结帖率/g;
        var reg7 = /总发帖：\d+/g;
        var reg8 = /正常结帖：\d+/g;
        var reg9 = /未结帖：\d+/g;
        var reg10 = /用户结帖率[\s\S]*\\n总发帖/g;

        var sj = txt3.match(reg6)[0].replace("截至", "").replace("\\n用户结帖率", "");
        var zft = txt3.match(reg7)[0].replace("总发帖：", "");
        var zcjt = txt3.match(reg8)[0].replace("正常结帖：", "");
        var wjt = txt3.match(reg9)[0].replace("未结帖：", "");
        var jtl = txt3.match(reg10)[0].replace("用户结帖率", "").replace("\\n总发帖", "");

        var edi_txt = "\n\r" + mingzi + ":你好!\n";
        edi_txt += "截至 " + sj + " 前:\n你已发帖 " + zft + " 个,\t\t\t未结贴 [color=#FF0000]" + wjt + "[/color] 个;\n结贴率为： [color=#FF0000]" + jtl + "[/color]\n";
        return edi_txt;
    }
    else {
        return "";
    }
    
}